<extend name="Home@Base/common" />
<block name="body">
    <div class="span9 page_message">
        <section id="contents"> <include file="Home@Addons/_nav" />
            <div class="tab-content">
                <php> $post_url || $post_url = U('add?model='.$model['id'], $get_param);</php>
                <form class="form-horizontal form-center" method="post" action="{$post_url}" id="form">
                    <div class="form-item cf">
                        <label class="item-label"> <span class="need_flag">*</span> 名称 </label>
                        <input type="text" class="text input-medium" name="name" value="{$data.name}">
                    </div>
                    <div class="form-item cf">
                        <label class="item-label"> <span class="need_flag">*</span> 位置类型 </label>
                        <div class="controls">
                            <select id="select_type" name="type" onchange="typeSelChange()">
                                <option value='wifi'>wifi</option>
                                <option value='gps'>gps</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-item cf">
                        <label class="item-label" id="label_ssid_longitude"> <span class="need_flag">*</span> wifi 名称 </label>
                        <div class="controls">
                            <input type="text" class="text input-medium" name="ssid_longitude" value="{$data.ssid_longitude}">
                        </div>
                    </div>

                    <div class="form-item cf">
                        <label class="item-label" id="label_bssid_latitude"> <span class="need_flag">*</span> wifi MAC地址 </label>
                        <div class="controls">
                            <input type="text" class="text input-medium" name="bssid_latitude" value="{$data.bssid_latitude}">
                        </div>
                    </div>

                    <div class="form-item cf" id="div_radius" style="display: none">
                        <label class="item-label" id="label_gps_radius"> gps 半径 </label>
                        <div class="controls">
                            <input type="text" class="text input-medium" name="gps_radius" value="{$data.gps_radius}">
                        </div>
                    </div>

                    <div class="form-item form_bh" style="width: 40%">
                        <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal" style="float: left">确 定</button>
                        <button class="btn cancel-btn" id="cancel" style="float: right" name="button_cancel" value=1>取 消</button>
                    </div>
                </form>
            </div>
        </section>
    </div>
</block>

<block name="script">
    <script type="text/javascript">

        function typeSelChange() {
            var type_sel = $('#select_type').val();

            if(type_sel == 'wifi') {
                document.getElementById("label_ssid_longitude").innerText = 'wifi 名称';
                document.getElementById("label_bssid_latitude").innerText = 'wifi MAC名称';
                document.getElementById("div_radius").style.display="none";
            }
            else {
                document.getElementById("label_ssid_longitude").innerText = 'gps 经度';
                document.getElementById("label_bssid_latitude").innerText = 'gps 纬度';
                document.getElementById("div_radius").style.display="";
            }
        }
    </script>
</block>